home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / RTLWIN16.PAK / COMMDLG.H < prev    next >
C/C++ Source or Header  |  1997-05-06  |  13KB  |  320 lines

  1. /* $Copyright: 1994$ */
  2.  
  3. /*****************************************************************************\
  4. *                                                                             *
  5. * commdlg.h -   Common dialog functions, types, and definitions               *
  6. *                                                                             *
  7. \*****************************************************************************/
  8.  
  9. #ifndef __COMMDLG_H     /* prevent multiple includes */
  10. #define __COMMDLG_H
  11.  
  12. #ifndef __WINDOWS_H
  13. #include <windows.h>    /* <windows.h> must be included */
  14. #endif  /* __WINDOWS_H */
  15.  
  16. #ifndef RC_INVOKED
  17. #pragma pack(push, 1)   /* Assume byte packing throughout */
  18. #endif /* !RC_INVOKED */
  19.  
  20. #ifdef __cplusplus
  21. extern "C" {            /* Assume C declarations for C++ */
  22. #endif  /* __cplusplus */
  23.  
  24. /* If included with the 3.0 windows.h, define compatible aliases */
  25. #if !defined(WINVER) || (WINVER < 0x030a)
  26. #define WINAPI      FAR PASCAL
  27. #define CALLBACK    FAR PASCAL
  28. #define LPCSTR      LPSTR
  29. #define UINT        WORD
  30. #define LPARAM      LONG
  31. #define WPARAM      WORD
  32. #define LRESULT     LONG
  33. #define HMODULE     HANDLE
  34. #define HINSTANCE   HANDLE
  35. #define HLOCAL      HANDLE
  36. #define HGLOBAL     HANDLE
  37. #endif  /* WIN3.0 */
  38.  
  39. typedef struct tagOFN
  40. {
  41.     DWORD   lStructSize;
  42.     HWND    hwndOwner;
  43.     HINSTANCE hInstance;
  44.     LPCSTR  lpstrFilter;
  45.     LPSTR   lpstrCustomFilter;
  46.     DWORD   nMaxCustFilter;
  47.     DWORD   nFilterIndex;
  48.     LPSTR   lpstrFile;
  49.     DWORD   nMaxFile;
  50.     LPSTR   lpstrFileTitle;
  51.     DWORD   nMaxFileTitle;
  52.     LPCSTR  lpstrInitialDir;
  53.     LPCSTR  lpstrTitle;
  54.     DWORD   Flags;
  55.     UINT    nFileOffset;
  56.     UINT    nFileExtension;
  57.     LPCSTR  lpstrDefExt;
  58.     LPARAM  lCustData;
  59.     UINT    (CALLBACK *lpfnHook)(HWND, UINT, WPARAM, LPARAM);
  60.     LPCSTR  lpTemplateName;
  61. }   OPENFILENAME;
  62. typedef OPENFILENAME FAR* LPOPENFILENAME;
  63.  
  64. BOOL    WINAPI GetOpenFileName(OPENFILENAME FAR*);
  65. BOOL    WINAPI GetSaveFileName(OPENFILENAME FAR*);
  66. int     WINAPI GetFileTitle(LPCSTR, LPSTR, UINT);
  67.  
  68. #define OFN_READONLY                 0x00000001L
  69. #define OFN_OVERWRITEPROMPT          0x00000002L
  70. #define OFN_HIDEREADONLY             0x00000004L
  71. #define OFN_NOCHANGEDIR              0x00000008L
  72. #define OFN_SHOWHELP                 0x00000010L
  73. #define OFN_ENABLEHOOK               0x00000020L
  74. #define OFN_ENABLETEMPLATE           0x00000040L
  75. #define OFN_ENABLETEMPLATEHANDLE     0x00000080L
  76. #define OFN_NOVALIDATE               0x00000100L
  77. #define OFN_ALLOWMULTISELECT         0x00000200L
  78. #define OFN_EXTENSIONDIFFERENT       0x00000400L
  79. #define OFN_PATHMUSTEXIST            0x00000800L
  80. #define OFN_FILEMUSTEXIST            0x00001000L
  81. #define OFN_CREATEPROMPT             0x00002000L
  82. #define OFN_SHAREAWARE               0x00004000L
  83. #define OFN_NOREADONLYRETURN         0x00008000L
  84. #define OFN_NOTESTFILECREATE         0x00010000L
  85.  
  86. /* Return values for the registered message sent to the hook function
  87.  * when a sharing violation occurs.  OFN_SHAREFALLTHROUGH allows the
  88.  * filename to be accepted, OFN_SHARENOWARN rejects the name but puts
  89.  * up no warning (returned when the app has already put up a warning
  90.  * message), and OFN_SHAREWARN puts up the default warning message
  91.  * for sharing violations.
  92.  *
  93.  * Note:  Undefined return values map to OFN_SHAREWARN, but are
  94.  *        reserved for future use.
  95.  */
  96.  
  97. #define OFN_SHAREFALLTHROUGH     2
  98. #define OFN_SHARENOWARN          1
  99. #define OFN_SHAREWARN            0
  100.  
  101. typedef struct tagCHOOSECOLOR
  102. {
  103.     DWORD   lStructSize;
  104.     HWND    hwndOwner;
  105.     HWND    hInstance;
  106.     COLORREF rgbResult;
  107.     COLORREF FAR* lpCustColors;
  108.     DWORD   Flags;
  109.     LPARAM  lCustData;
  110.     UINT    (CALLBACK* lpfnHook)(HWND, UINT, WPARAM, LPARAM);
  111.     LPCSTR  lpTemplateName;
  112. } CHOOSECOLOR;
  113. typedef CHOOSECOLOR FAR *LPCHOOSECOLOR;
  114.  
  115. BOOL    WINAPI ChooseColor(CHOOSECOLOR FAR*);
  116.  
  117. #define CC_RGBINIT               0x00000001L
  118. #define CC_FULLOPEN              0x00000002L
  119. #define CC_PREVENTFULLOPEN       0x00000004L
  120. #define CC_SHOWHELP              0x00000008L
  121. #define CC_ENABLEHOOK            0x00000010L
  122. #define CC_ENABLETEMPLATE        0x00000020L
  123. #define CC_ENABLETEMPLATEHANDLE  0x00000040L
  124.  
  125. typedef struct tagFINDREPLACE
  126. {
  127.     DWORD    lStructSize;            /* size of this struct 0x20 */
  128.     HWND     hwndOwner;              /* handle to owner's window */
  129.     HINSTANCE hInstance;             /* instance handle of.EXE that
  130.                                       * contains cust. dlg. template
  131.                                       */
  132.     DWORD    Flags;                  /* one or more of the FR_?? */
  133.     LPSTR    lpstrFindWhat;          /* ptr. to search string    */
  134.     LPSTR    lpstrReplaceWith;       /* ptr. to replace string   */
  135.     UINT     wFindWhatLen;           /* size of find buffer      */
  136.     UINT     wReplaceWithLen;        /* size of replace buffer   */
  137.     LPARAM   lCustData;              /* data passed to hook fn.  */
  138.     UINT    (CALLBACK* lpfnHook)(HWND, UINT, WPARAM, LPARAM);
  139.                                      /* ptr. to hook fn. or NULL */
  140.     LPCSTR   lpTemplateName;         /* custom template name     */
  141. } FINDREPLACE;
  142. typedef FINDREPLACE FAR *LPFINDREPLACE;
  143.  
  144. #define FR_DOWN                         0x00000001L
  145. #define FR_WHOLEWORD                    0x00000002L
  146. #define FR_MATCHCASE                    0x00000004L
  147. #define FR_FINDNEXT                     0x00000008L
  148. #define FR_REPLACE                      0x00000010L
  149. #define FR_REPLACEALL                   0x00000020L
  150. #define FR_DIALOGTERM                   0x00000040L
  151. #define FR_SHOWHELP                     0x00000080L
  152. #define FR_ENABLEHOOK                   0x00000100L
  153. #define FR_ENABLETEMPLATE               0x00000200L
  154. #define FR_NOUPDOWN                     0x00000400L
  155. #define FR_NOMATCHCASE                  0x00000800L
  156. #define FR_NOWHOLEWORD                  0x00001000L
  157. #define FR_ENABLETEMPLATEHANDLE         0x00002000L
  158. #define FR_HIDEUPDOWN                   0x00004000L
  159. #define FR_HIDEMATCHCASE                0x00008000L
  160. #define FR_HIDEWHOLEWORD                0x00010000L
  161.  
  162. HWND    WINAPI FindText(FINDREPLACE FAR*);
  163. HWND    WINAPI ReplaceText(FINDREPLACE FAR*);
  164.  
  165. typedef struct tagCHOOSEFONT
  166. {
  167.     DWORD           lStructSize;        /* */
  168.     HWND            hwndOwner;          /* caller's window handle   */
  169.     HDC             hDC;                /* printer DC/IC or NULL    */
  170.     LOGFONT FAR*    lpLogFont;          /* ptr. to a LOGFONT struct */
  171.     int             iPointSize;         /* 10 * size in points of selected font */
  172.     DWORD           Flags;              /* enum. type flags         */
  173.     COLORREF        rgbColors;          /* returned text color      */
  174.     LPARAM          lCustData;          /* data passed to hook fn.  */
  175.     UINT (CALLBACK* lpfnHook)(HWND, UINT, WPARAM, LPARAM);
  176.                                         /* ptr. to hook function    */
  177.     LPCSTR          lpTemplateName;     /* custom template name     */
  178.     HINSTANCE       hInstance;          /* instance handle of.EXE that
  179.                                          * contains cust. dlg. template
  180.                                          */
  181.     LPSTR           lpszStyle;          /* return the style field here
  182.                                          * must be LF_FACESIZE or bigger */
  183.     UINT            nFontType;          /* same value reported to the EnumFonts
  184.                                          * call back with the extra FONTTYPE_
  185.                                          * bits added */
  186.     int             nSizeMin;           /* minimum pt size allowed & */
  187.     int             nSizeMax;           /* max pt size allowed if    */
  188.                                         /* CF_LIMITSIZE is used      */
  189. } CHOOSEFONT;
  190. typedef CHOOSEFONT FAR *LPCHOOSEFONT;
  191.  
  192. BOOL WINAPI ChooseFont(CHOOSEFONT FAR*);
  193.  
  194. #define CF_SCREENFONTS               0x00000001L
  195. #define CF_PRINTERFONTS              0x00000002L
  196. #define CF_BOTH                      (CF_SCREENFONTS | CF_PRINTERFONTS)
  197. #define CF_SHOWHELP                  0x00000004L
  198. #define CF_ENABLEHOOK                0x00000008L
  199. #define CF_ENABLETEMPLATE            0x00000010L
  200. #define CF_ENABLETEMPLATEHANDLE      0x00000020L
  201. #define CF_INITTOLOGFONTSTRUCT       0x00000040L
  202. #define CF_USESTYLE                  0x00000080L
  203. #define CF_EFFECTS                   0x00000100L
  204. #define CF_APPLY                     0x00000200L
  205. #define CF_ANSIONLY                  0x00000400L
  206. #define CF_NOVECTORFONTS             0x00000800L
  207. #define CF_NOOEMFONTS                CF_NOVECTORFONTS
  208. #define CF_NOSIMULATIONS             0x00001000L
  209. #define CF_LIMITSIZE                 0x00002000L
  210. #define CF_FIXEDPITCHONLY            0x00004000L
  211. #define CF_WYSIWYG                   0x00008000L /* must also have CF_SCREENFONTS & CF_PRINTERFONTS */
  212. #define CF_FORCEFONTEXIST            0x00010000L
  213. #define CF_SCALABLEONLY              0x00020000L
  214. #define CF_TTONLY                    0x00040000L
  215. #define CF_NOFACESEL                 0x00080000L
  216. #define CF_NOSTYLESEL                0x00100000L
  217. #define CF_NOSIZESEL                 0x00200000L
  218.  
  219. /* these are extra nFontType bits that are added to what is returned to the
  220.  * EnumFonts callback routine */
  221.  
  222. #define SIMULATED_FONTTYPE      0x8000
  223. #define PRINTER_FONTTYPE        0x4000
  224. #define SCREEN_FONTTYPE         0x2000
  225. #define BOLD_FONTTYPE           0x0100
  226. #define ITALIC_FONTTYPE         0x0200
  227. #define REGULAR_FONTTYPE        0x0400
  228.  
  229. #define WM_CHOOSEFONT_GETLOGFONT        (WM_USER + 1)
  230.  
  231.  
  232. /* strings used to obtain unique window message for communication
  233.  * between dialog and caller
  234.  */
  235. #define LBSELCHSTRING  "commdlg_LBSelChangedNotify"
  236. #define SHAREVISTRING  "commdlg_ShareViolation"
  237. #define FILEOKSTRING   "commdlg_FileNameOK"
  238. #define COLOROKSTRING  "commdlg_ColorOK"
  239. #define SETRGBSTRING   "commdlg_SetRGBColor"
  240. #define FINDMSGSTRING  "commdlg_FindReplace"
  241. #define HELPMSGSTRING  "commdlg_help"
  242.  
  243. /* HIWORD values for lParam of commdlg_LBSelChangeNotify message */
  244. #define CD_LBSELNOITEMS -1
  245. #define CD_LBSELCHANGE   0
  246. #define CD_LBSELSUB      1
  247. #define CD_LBSELADD      2
  248.  
  249. typedef struct tagPD
  250. {
  251.     DWORD   lStructSize;
  252.     HWND    hwndOwner;
  253.     HGLOBAL hDevMode;
  254.     HGLOBAL hDevNames;
  255.     HDC     hDC;
  256.     DWORD   Flags;
  257.     UINT    nFromPage;
  258.     UINT    nToPage;
  259.     UINT    nMinPage;
  260.     UINT    nMaxPage;
  261.     UINT    nCopies;
  262.     HINSTANCE hInstance;
  263.     LPARAM  lCustData;
  264.     UINT    (CALLBACK* lpfnPrintHook)(HWND, UINT, WPARAM, LPARAM);
  265.     UINT    (CALLBACK* lpfnSetupHook)(HWND, UINT, WPARAM, LPARAM);
  266.     LPCSTR  lpPrintTemplateName;
  267.     LPCSTR  lpSetupTemplateName;
  268.     HGLOBAL hPrintTemplate;
  269.     HGLOBAL hSetupTemplate;
  270. } PRINTDLG;
  271. typedef PRINTDLG  FAR* LPPRINTDLG;
  272.  
  273. BOOL    WINAPI PrintDlg(PRINTDLG FAR*);
  274.  
  275. #define PD_ALLPAGES                  0x00000000L
  276. #define PD_SELECTION                 0x00000001L
  277. #define PD_PAGENUMS                  0x00000002L
  278. #define PD_NOSELECTION               0x00000004L
  279. #define PD_NOPAGENUMS                0x00000008L
  280. #define PD_COLLATE                   0x00000010L
  281. #define PD_PRINTTOFILE               0x00000020L
  282. #define PD_PRINTSETUP                0x00000040L
  283. #define PD_NOWARNING                 0x00000080L
  284. #define PD_RETURNDC                  0x00000100L
  285. #define PD_RETURNIC                  0x00000200L
  286. #define PD_RETURNDEFAULT             0x00000400L
  287. #define PD_SHOWHELP                  0x00000800L
  288. #define PD_ENABLEPRINTHOOK           0x00001000L
  289. #define PD_ENABLESETUPHOOK           0x00002000L
  290. #define PD_ENABLEPRINTTEMPLATE       0x00004000L
  291. #define PD_ENABLESETUPTEMPLATE       0x00008000L
  292. #define PD_ENABLEPRINTTEMPLATEHANDLE 0x00010000L
  293. #define PD_ENABLESETUPTEMPLATEHANDLE 0x00020000L
  294. #define PD_USEDEVMODECOPIES          0x00040000L
  295. #define PD_DISABLEPRINTTOFILE        0x00080000L
  296. #define PD_HIDEPRINTTOFILE           0x00100000L
  297.  
  298. typedef struct tagDEVNAMES
  299. {
  300.     UINT wDriverOffset;
  301.     UINT wDeviceOffset;
  302.     UINT wOutputOffset;
  303.     UINT wDefault;
  304. } DEVNAMES;
  305. typedef DEVNAMES FAR* LPDEVNAMES;
  306.  
  307. #define DN_DEFAULTPRN      0x0001
  308.  
  309. DWORD   WINAPI CommDlgExtendedError(void);
  310.  
  311. #ifdef __cplusplus
  312. }                                                                /* end extern "C"  */
  313. #endif  /* __cplusplus */
  314.  
  315. #ifndef RC_INVOKED
  316. #pragma pack(pop)       /* Revert to default packing */
  317. #endif  /* RC_INVOKED */
  318.  
  319. #endif  /* __COMMDLG_H */
  320.